#define _CRT_SECURE_NO_WARNINGS 1
#include "contact.h"

void meau()
{
	printf("*********************************\n");
	printf("**** 1,add         2.del      ***\n");
	printf("**** 3.search      4.modify   ***\n");
	printf("**** 5.show          6.sort   ***\n");
	printf("**** 0.exit                   ***\n");
	printf("*********************************\n");
}
void test()
{
	int input = 0;
	//创建通讯录
	Contact con;
	InitContact(&con);
	do
	{
		meau();
		printf("请输入:>\n");
		scanf("%d", &input);
		switch(input)
		{
		case  Add:
			AddContact(&con);
			break;
		case Del:
			DelContact(&con);
			break;
		case Search:
			SearchContact(&con);
			break;
		case Modify:
			ModifyContact(&con);
			break;
		case Show:
			ShowContact(&con);
			break;
		case Sort:
			SortContactAge(&con);
			break;
		case Exit:
			DestoryContact(&con);
			printf("退出通讯录\n");
			break;
		default:
			printf("输入错误,请重新输入\n");
			break;
		}
	} while (input);
}
int main()
{
	test();
	return 0;
}
